package com.javasix;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test3 {
    public static void main(String[] args) {
        Demo2 demo2 = new Demo2();
        Demo2 demo3 = new Demo2();
        Demo2 demo4 = new Demo2();
        Demo2 demo5 = new Demo2();
        //固定数量的线程池
        ExecutorService executorService = Executors.newFixedThreadPool(3);
        executorService.submit(demo2);
        executorService.submit(demo3);
        executorService.submit(demo4);
        executorService.submit(demo5);


       /* Thread thread = new Thread(demo2,"1号线程");
        Thread thread2 = new Thread(demo2,"2号线程");
        thread.start();
        thread2.start();*/
    }
}
